package top.saybook.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.saybook.service.BookService;
import top.saybook.service.ChapterService;

@RestController
@CrossOrigin
public class CacheController {

    @Autowired
    private BookService bookService;
    @Autowired
    private ChapterService chapterService;

    /**
     * 重新缓存某本书的所有章节
     *      主动调用，直接删除缓存和数据库，重新保存
     */
    @RequestMapping("/cacheBookChapter")
    public String cacheBookChapter(Integer bookId){
        chapterService.delete(bookId);
        return "";
    }

    
}
